/**
 *
 */
import Util;
import OpenApi;
import OpenApiUtil;
import EndpointUtil;

extends OpenApi;


init(config: OpenApi.Config){
  super(config);
  @endpointRule = '';
  
  checkConfig(config);
  @endpoint = getEndpoint('yunjian', @regionId, @endpointRule, @network, @suffix, @endpointMap, @endpoint);
}

function getEndpoint(productId: string, regionId: string, endpointRule: string, network: string, suffix: string, endpointMap: map[string]string, endpoint: string) throws: string{
  if (!Util.empty(endpoint)) {
    return endpoint;
  }
  
  if (!Util.isUnset(endpointMap) && !Util.empty(endpointMap[regionId])) {
    return endpointMap[regionId];
  }
  return EndpointUtil.getEndpointRules(productId, regionId, endpointRule, network, suffix);
}

model CreateDemandPlanHeaders {
  commonHeaders?: map[string]string,
  yunUserId?: string(name='Yun-User-Id', example='262940'),
}

model CreateDemandPlanRequest {
  accountId?: string(name='accountId', example='1065737167271819'),
  description?: string(name='description'),
  name?: string(name='name'),
  period?: string(name='period', example='FY2022'),
  source?: string(name='source'),
  type?: string(name='type', example='URGENT'),
  userId?: string(name='userId', example='262940'),
}

model CreateDemandPlanResponseBody = {
  code?: long(name='code', description='code', example='0'),
  data?: long(name='data', example='111223'),
  message?: string(name='message', example='msg'),
  success?: boolean(name='success', description='success', example='true'),
  traceId?: string(name='traceId', description='traceId', example='1e2b798516402440016572132e1459'),
}

model CreateDemandPlanResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: CreateDemandPlanResponseBody(name='body'),
}

async function createDemandPlanWithOptions(request: CreateDemandPlanRequest, headers: CreateDemandPlanHeaders, runtime: Util.RuntimeOptions): CreateDemandPlanResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.userId)) {
    query['userId'] = request.userId;
  }

  var body : map[string]any = {};
  if (!Util.isUnset(request.accountId)) {
    body['accountId'] = request.accountId;
  }
  if (!Util.isUnset(request.description)) {
    body['description'] = request.description;
  }
  if (!Util.isUnset(request.name)) {
    body['name'] = request.name;
  }
  if (!Util.isUnset(request.period)) {
    body['period'] = request.period;
  }
  if (!Util.isUnset(request.source)) {
    body['source'] = request.source;
  }
  if (!Util.isUnset(request.type)) {
    body['type'] = request.type;
  }

  var realHeaders : map[string]string = {};
  if (!Util.isUnset(headers.commonHeaders)) {
    realHeaders = headers.commonHeaders;
  }
  if (!Util.isUnset(headers.yunUserId)) {
    realHeaders['Yun-User-Id'] = Util.toJSONString(headers.yunUserId);
  }
  var req = new OpenApi.OpenApiRequest{ 
    headers = realHeaders,
    query = OpenApiUtil.query(query),
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'CreateDemandPlan',
    version = '2021-12-17',
    protocol = 'HTTPS',
    pathname = `/api/demand/urgent/saveUrgentDemandPlanItem`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function createDemandPlan(request: CreateDemandPlanRequest): CreateDemandPlanResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers = new CreateDemandPlanHeaders{};
  return createDemandPlanWithOptions(request, headers, runtime);
}

model CreateDemandPlanV2Headers {
  commonHeaders?: map[string]string,
  yunUserId?: string(name='Yun-User-Id'),
}

model CreateDemandPlanV2Request {
  accountId?: string(name='accountId'),
  description?: string(name='description'),
  name?: string(name='name'),
  productType?: string(name='productType'),
  type?: string(name='type'),
  userId?: string(name='userId'),
}

model CreateDemandPlanV2ResponseBody = {
  code?: long(name='code'),
  data?: long(name='data'),
  message?: string(name='message'),
  success?: boolean(name='success'),
  traceId?: string(name='traceId'),
}

model CreateDemandPlanV2Response = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: CreateDemandPlanV2ResponseBody(name='body'),
}

async function createDemandPlanV2WithOptions(request: CreateDemandPlanV2Request, headers: CreateDemandPlanV2Headers, runtime: Util.RuntimeOptions): CreateDemandPlanV2Response {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.userId)) {
    query['userId'] = request.userId;
  }

  var body : map[string]any = {};
  if (!Util.isUnset(request.accountId)) {
    body['accountId'] = request.accountId;
  }
  if (!Util.isUnset(request.description)) {
    body['description'] = request.description;
  }
  if (!Util.isUnset(request.name)) {
    body['name'] = request.name;
  }
  if (!Util.isUnset(request.productType)) {
    body['productType'] = request.productType;
  }
  if (!Util.isUnset(request.type)) {
    body['type'] = request.type;
  }

  var realHeaders : map[string]string = {};
  if (!Util.isUnset(headers.commonHeaders)) {
    realHeaders = headers.commonHeaders;
  }
  if (!Util.isUnset(headers.yunUserId)) {
    realHeaders['Yun-User-Id'] = Util.toJSONString(headers.yunUserId);
  }
  var req = new OpenApi.OpenApiRequest{ 
    headers = realHeaders,
    query = OpenApiUtil.query(query),
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'CreateDemandPlanV2',
    version = '2021-12-17',
    protocol = 'HTTPS',
    pathname = `/api/demand/urgent/saveDemandPlan`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function createDemandPlanV2(request: CreateDemandPlanV2Request): CreateDemandPlanV2Response {
  var runtime = new Util.RuntimeOptions{};
  var headers = new CreateDemandPlanV2Headers{};
  return createDemandPlanV2WithOptions(request, headers, runtime);
}

model DeleteUrgentDemandItemHeaders {
  commonHeaders?: map[string]string,
  yunUserId?: string(name='Yun-User-Id', example='111222'),
}

model DeleteUrgentDemandItemRequest {
  id?: long(name='id', example='111222'),
  modifier?: string(name='modifier', example='111222'),
}

model DeleteUrgentDemandItemResponseBody = {
  code?: long(name='code', example='0'),
  data?: long(name='data', example='1'),
  message?: string(name='message', example='msg'),
  success?: boolean(name='success', example='true'),
  traceId?: string(name='traceId', example='212cf01016405759151137225e83cd'),
}

model DeleteUrgentDemandItemResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DeleteUrgentDemandItemResponseBody(name='body'),
}

async function deleteUrgentDemandItemWithOptions(request: DeleteUrgentDemandItemRequest, headers: DeleteUrgentDemandItemHeaders, runtime: Util.RuntimeOptions): DeleteUrgentDemandItemResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.id)) {
    query['id'] = request.id;
  }
  if (!Util.isUnset(request.modifier)) {
    query['modifier'] = request.modifier;
  }

  var realHeaders : map[string]string = {};
  if (!Util.isUnset(headers.commonHeaders)) {
    realHeaders = headers.commonHeaders;
  }
  if (!Util.isUnset(headers.yunUserId)) {
    realHeaders['Yun-User-Id'] = Util.toJSONString(headers.yunUserId);
  }
  var req = new OpenApi.OpenApiRequest{ 
    headers = realHeaders,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DeleteUrgentDemandItem',
    version = '2021-12-17',
    protocol = 'HTTPS',
    pathname = `/api/demand/urgent/deleteUrgentDemandItem`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function deleteUrgentDemandItem(request: DeleteUrgentDemandItemRequest): DeleteUrgentDemandItemResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers = new DeleteUrgentDemandItemHeaders{};
  return deleteUrgentDemandItemWithOptions(request, headers, runtime);
}

model DeleteUrgentDemandPlanHeaders {
  commonHeaders?: map[string]string,
  yunUserId?: string(name='Yun-User-Id', example='111222'),
}

model DeleteUrgentDemandPlanRequest {
  id?: long(name='id', example='111111'),
  modifier?: string(name='modifier', example='222111'),
}

model DeleteUrgentDemandPlanResponseBody = {
  code?: long(name='code', example='0'),
  data?: long(name='data', example='1'),
  message?: string(name='message', example='msg'),
  success?: boolean(name='success', example='true'),
  traceId?: string(name='traceId', example='212cf01016405759151137225e83cd'),
}

model DeleteUrgentDemandPlanResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DeleteUrgentDemandPlanResponseBody(name='body'),
}

async function deleteUrgentDemandPlanWithOptions(request: DeleteUrgentDemandPlanRequest, headers: DeleteUrgentDemandPlanHeaders, runtime: Util.RuntimeOptions): DeleteUrgentDemandPlanResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.id)) {
    query['id'] = request.id;
  }
  if (!Util.isUnset(request.modifier)) {
    query['modifier'] = request.modifier;
  }

  var realHeaders : map[string]string = {};
  if (!Util.isUnset(headers.commonHeaders)) {
    realHeaders = headers.commonHeaders;
  }
  if (!Util.isUnset(headers.yunUserId)) {
    realHeaders['Yun-User-Id'] = Util.toJSONString(headers.yunUserId);
  }
  var req = new OpenApi.OpenApiRequest{ 
    headers = realHeaders,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DeleteUrgentDemandPlan',
    version = '2021-12-17',
    protocol = 'HTTPS',
    pathname = `/api/demand/urgent/deleteUrgentDemandPlan`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function deleteUrgentDemandPlan(request: DeleteUrgentDemandPlanRequest): DeleteUrgentDemandPlanResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers = new DeleteUrgentDemandPlanHeaders{};
  return deleteUrgentDemandPlanWithOptions(request, headers, runtime);
}

model DeliveryItemDetailSynHeaders {
  commonHeaders?: map[string]string,
  yunUserId?: string(name='Yun-User-Id'),
}

model DeliveryItemDetailSynRequest {
  channel?: string(name='channel'),
  deliveryItemDetailDTOS?: [ 
    {
      actualSupplyTime?: string(name='actualSupplyTime'),
      amount?: long(name='amount'),
      comment?: string(name='comment'),
      deliveredAmount?: long(name='deliveredAmount'),
      deliveryItemId?: string(name='deliveryItemId'),
      deliveryPlanId?: string(name='deliveryPlanId'),
      lastSupplyTime?: string(name='lastSupplyTime'),
      status?: string(name='status'),
      subDemandSupplyPerformerName?: string(name='subDemandSupplyPerformerName'),
      subDemandSupplyPerformerUid?: string(name='subDemandSupplyPerformerUid'),
      subDemandSupplyPmName?: string(name='subDemandSupplyPmName'),
      subDemandSupplyPmUid?: string(name='subDemandSupplyPmUid'),
      subOrderId?: long(name='subOrderId'),
      supplyStatus?: string(name='supplyStatus'),
      totalOrderId?: long(name='totalOrderId'),
    }
  ](name='deliveryItemDetailDTOS'),
  deliveryItemId?: string(name='deliveryItemId'),
  deliveryPlanId?: string(name='deliveryPlanId'),
}

model DeliveryItemDetailSynResponseBody = {
  code?: long(name='code', example='0'),
  data?: boolean(name='data', example='true'),
  message?: string(name='message', example='msg'),
  success?: boolean(name='success', example='true'),
  traceId?: string(name='traceId', example='212cf01016405759151137225e83cd'),
}

model DeliveryItemDetailSynResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DeliveryItemDetailSynResponseBody(name='body'),
}

async function deliveryItemDetailSynWithOptions(request: DeliveryItemDetailSynRequest, headers: DeliveryItemDetailSynHeaders, runtime: Util.RuntimeOptions): DeliveryItemDetailSynResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.channel)) {
    body['channel'] = request.channel;
  }
  if (!Util.isUnset(request.deliveryItemDetailDTOS)) {
    body['deliveryItemDetailDTOS'] = request.deliveryItemDetailDTOS;
  }
  if (!Util.isUnset(request.deliveryItemId)) {
    body['deliveryItemId'] = request.deliveryItemId;
  }
  if (!Util.isUnset(request.deliveryPlanId)) {
    body['deliveryPlanId'] = request.deliveryPlanId;
  }

  var realHeaders : map[string]string = {};
  if (!Util.isUnset(headers.commonHeaders)) {
    realHeaders = headers.commonHeaders;
  }
  if (!Util.isUnset(headers.yunUserId)) {
    realHeaders['Yun-User-Id'] = Util.toJSONString(headers.yunUserId);
  }
  var req = new OpenApi.OpenApiRequest{ 
    headers = realHeaders,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'DeliveryItemDetailSyn',
    version = '2021-12-17',
    protocol = 'HTTPS',
    pathname = `/api/supply/deliveryItemDataSync`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function deliveryItemDetailSyn(request: DeliveryItemDetailSynRequest): DeliveryItemDetailSynResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers = new DeliveryItemDetailSynHeaders{};
  return deliveryItemDetailSynWithOptions(request, headers, runtime);
}

model GetUrgentDemandItemListHeaders {
  commonHeaders?: map[string]string,
  yunUserId?: string(name='Yun-User-Id', example='111222'),
}

model GetUrgentDemandItemListRequest {
  commodityCode?: string(name='commodityCode'),
  commodityTypeCode?: string(name='commodityTypeCode', example='ecs/yundisk'),
  current?: long(name='current', example='1'),
  planId?: long(name='planId'),
  region?: string(name='region'),
  size?: long(name='size', example='10'),
  zone?: string(name='zone'),
}

model GetUrgentDemandItemListResponseBody = {
  code?: long(name='code'),
  data?: {
    current?: long(name='current'),
    pages?: long(name='pages'),
    records?: [ 
      {
        zone?: string(name='Zone'),
        accountId?: string(name='accountId'),
        commodityCode?: string(name='commodityCode'),
        commodityNum?: long(name='commodityNum'),
        commodityTypeCode?: string(name='commodityTypeCode'),
        creator?: string(name='creator'),
        creatorName?: string(name='creatorName'),
        effectTime?: string(name='effectTime'),
        gmtModified?: string(name='gmtModified'),
        id?: long(name='id'),
        modifier?: string(name='modifier'),
        modifierName?: string(name='modifierName'),
        networkType?: string(name='networkType'),
        payDuration?: long(name='payDuration'),
        payDurationUnit?: string(name='payDurationUnit'),
        payType?: string(name='payType'),
        planId?: long(name='planId'),
        region?: string(name='region'),
        urgentDemandEbsRequest?: {
          commodityCode?: string(name='commodityCode', example='cloud_essd'),
          commodityNum?: long(name='commodityNum', example='1'),
          commodityTypeCode?: string(name='commodityTypeCode', example='yundisk'),
          dataDiskSize?: long(name='dataDiskSize', example='1'),
          itemId?: long(name='itemId', example='111222'),
          performanceLevel?: long(name='performanceLevel', example='1'),
        }(name='urgentDemandEbsRequest'),
        urgentDemandEcsRequest?: {
          commodityCode?: string(name='commodityCode'),
          commodityNum?: long(name='commodityNum'),
          commodityTypeCode?: string(name='commodityTypeCode'),
          itemId?: long(name='itemId'),
          vcpuCount?: long(name='vcpuCount'),
        }(name='urgentDemandEcsRequest'),
      }
    ](name='records'),
    size?: long(name='size'),
    total?: long(name='total'),
  }(name='data'),
  message?: string(name='message'),
  success?: boolean(name='success'),
  traceId?: string(name='traceId'),
}

model GetUrgentDemandItemListResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: GetUrgentDemandItemListResponseBody(name='body'),
}

async function getUrgentDemandItemListWithOptions(request: GetUrgentDemandItemListRequest, headers: GetUrgentDemandItemListHeaders, runtime: Util.RuntimeOptions): GetUrgentDemandItemListResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.commodityCode)) {
    body['commodityCode'] = request.commodityCode;
  }
  if (!Util.isUnset(request.commodityTypeCode)) {
    body['commodityTypeCode'] = request.commodityTypeCode;
  }
  if (!Util.isUnset(request.current)) {
    body['current'] = request.current;
  }
  if (!Util.isUnset(request.planId)) {
    body['planId'] = request.planId;
  }
  if (!Util.isUnset(request.region)) {
    body['region'] = request.region;
  }
  if (!Util.isUnset(request.size)) {
    body['size'] = request.size;
  }
  if (!Util.isUnset(request.zone)) {
    body['zone'] = request.zone;
  }

  var realHeaders : map[string]string = {};
  if (!Util.isUnset(headers.commonHeaders)) {
    realHeaders = headers.commonHeaders;
  }
  if (!Util.isUnset(headers.yunUserId)) {
    realHeaders['Yun-User-Id'] = Util.toJSONString(headers.yunUserId);
  }
  var req = new OpenApi.OpenApiRequest{ 
    headers = realHeaders,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'GetUrgentDemandItemList',
    version = '2021-12-17',
    protocol = 'HTTPS',
    pathname = `/api/demand/urgent/getUrgentDemandItemList`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getUrgentDemandItemList(request: GetUrgentDemandItemListRequest): GetUrgentDemandItemListResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers = new GetUrgentDemandItemListHeaders{};
  return getUrgentDemandItemListWithOptions(request, headers, runtime);
}

model GetUrgentDemandPlanDetailHeaders {
  commonHeaders?: map[string]string,
  yunUserId?: string(name='Yun-User-Id', example='262940'),
}

model GetUrgentDemandPlanDetailRequest {
  planId?: string(name='planId', example='111223'),
}

model GetUrgentDemandPlanDetailResponseBody = {
  code?: long(name='code', description='code', example='0'),
  data?: {
    accountDept?: string(name='accountDept'),
    accountId?: string(name='accountId', example='1065737167271819'),
    accountName?: string(name='accountName', example='larus_prd'),
    approvalUrl?: string(name='approvalUrl', example='https://xxxxx'),
    bpmSubstate?: map[string]any(name='bpmSubstate', example='{}'),
    commodityTypeCodeList?: [ string ](name='commodityTypeCodeList'),
    creator?: string(name='creator', example='262940'),
    creatorName?: string(name='creatorName', example='xxx'),
    description?: string(name='description', example='xxx'),
    detailType?: string(name='detailType', example='URGENT'),
    gmtCreate?: string(name='gmtCreate', example='2021-12-17 16:53:21'),
    gmtModified?: string(name='gmtModified', example='2021-12-17 16:53:21'),
    modifier?: string(name='modifier', example='262940'),
    modifierName?: string(name='modifierName', example='xx'),
    planId?: long(name='planId', example='11223'),
    planName?: string(name='planName'),
    status?: long(name='status', example='220'),
    yunzhiProductName?: string(name='yunzhiProductName'),
  }(name='data', description='body'),
  message?: string(name='message', example='msg'),
  success?: boolean(name='success', description='success', example='true'),
  traceId?: string(name='traceId', description='traceId', example='1e2b798516402440016572132e1459'),
}

model GetUrgentDemandPlanDetailResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: GetUrgentDemandPlanDetailResponseBody(name='body'),
}

async function getUrgentDemandPlanDetailWithOptions(request: GetUrgentDemandPlanDetailRequest, headers: GetUrgentDemandPlanDetailHeaders, runtime: Util.RuntimeOptions): GetUrgentDemandPlanDetailResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.planId)) {
    body['planId'] = request.planId;
  }

  var realHeaders : map[string]string = {};
  if (!Util.isUnset(headers.commonHeaders)) {
    realHeaders = headers.commonHeaders;
  }
  if (!Util.isUnset(headers.yunUserId)) {
    realHeaders['Yun-User-Id'] = Util.toJSONString(headers.yunUserId);
  }
  var req = new OpenApi.OpenApiRequest{ 
    headers = realHeaders,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'GetUrgentDemandPlanDetail',
    version = '2021-12-17',
    protocol = 'HTTPS',
    pathname = `/api/demand/urgent/getUrgentDemandPlanDetail`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getUrgentDemandPlanDetail(request: GetUrgentDemandPlanDetailRequest): GetUrgentDemandPlanDetailResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers = new GetUrgentDemandPlanDetailHeaders{};
  return getUrgentDemandPlanDetailWithOptions(request, headers, runtime);
}

model GetUrgentDemandPlanListHeaders {
  commonHeaders?: map[string]string,
  yunUserId?: string(name='Yun-User-Id', example='111222'),
}

model GetUrgentDemandPlanListRequest {
  current?: long(name='current', example='1'),
  period?: string(name='period', example='FY2022'),
  planType?: long(name='planType', example='0'),
  size?: long(name='size', example='10'),
  userId?: string(name='userId', example='111222'),
}

model GetUrgentDemandPlanListResponseBody = {
  code?: long(name='code', example='0'),
  data?: {
    current?: long(name='current', example='1'),
    pages?: long(name='pages', example='2'),
    records?: [ 
      {
        accountId?: string(name='accountId', example='1705524002740212'),
        accountName?: string(name='accountName', example='xxxx'),
        accountType?: string(name='accountType', example='ALIYUN'),
        approvalUrl?: string(name='approvalUrl', example='https://xxx'),
        creator?: string(name='creator', example='1111'),
        creatorName?: string(name='creatorName', example='xxxx'),
        description?: string(name='description', example='xxxx'),
        gmtCreate?: string(name='gmtCreate', example='2021-12-20 10:29:50'),
        gmtModified?: string(name='gmtModified', example='2021-12-20 10:29:50'),
        modifier?: string(name='modifier', example='xxxx'),
        modifierName?: string(name='modifierName', example='xxxx'),
        planId?: long(name='planId'),
        planName?: string(name='planName'),
        status?: long(name='status'),
      }
    ](name='records'),
    size?: long(name='size', example='10'),
    total?: long(name='total', example='15'),
  }(name='data'),
  message?: string(name='message', example='msg'),
  success?: boolean(name='success', example='true'),
  traceId?: string(name='traceId', example='2127968716405850615204514e9332'),
}

model GetUrgentDemandPlanListResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: GetUrgentDemandPlanListResponseBody(name='body'),
}

async function getUrgentDemandPlanListWithOptions(request: GetUrgentDemandPlanListRequest, headers: GetUrgentDemandPlanListHeaders, runtime: Util.RuntimeOptions): GetUrgentDemandPlanListResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.current)) {
    body['current'] = request.current;
  }
  if (!Util.isUnset(request.period)) {
    body['period'] = request.period;
  }
  if (!Util.isUnset(request.planType)) {
    body['planType'] = request.planType;
  }
  if (!Util.isUnset(request.size)) {
    body['size'] = request.size;
  }
  if (!Util.isUnset(request.userId)) {
    body['userId'] = request.userId;
  }

  var realHeaders : map[string]string = {};
  if (!Util.isUnset(headers.commonHeaders)) {
    realHeaders = headers.commonHeaders;
  }
  if (!Util.isUnset(headers.yunUserId)) {
    realHeaders['Yun-User-Id'] = Util.toJSONString(headers.yunUserId);
  }
  var req = new OpenApi.OpenApiRequest{ 
    headers = realHeaders,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'GetUrgentDemandPlanList',
    version = '2021-12-17',
    protocol = 'HTTPS',
    pathname = `/api/demand/urgent/getUrgentDemandPlanList`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getUrgentDemandPlanList(request: GetUrgentDemandPlanListRequest): GetUrgentDemandPlanListResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers = new GetUrgentDemandPlanListHeaders{};
  return getUrgentDemandPlanListWithOptions(request, headers, runtime);
}

model PushResourcePlanHeaders {
  commonHeaders?: map[string]string,
  yunUserId?: string(name='Yun-User-Id'),
}

model PushResourcePlanRequest {
  bufferCnt?: long(name='bufferCnt'),
  demandCount?: long(name='demandCount'),
  demandId?: string(name='demandId'),
  methodList?: [ 
    {
      azone?: string(name='azone'),
      bufferCnt?: long(name='bufferCnt'),
      cluster?: string(name='cluster'),
      comment?: string(name='comment'),
      convertHostCnt?: long(name='convertHostCnt'),
      convertHostType?: string(name='convertHostType'),
      dataList?: [ 
        {
          classZone?: string(name='classZone'),
          convertHostType?: string(name='convertHostType'),
          logicZone?: string(name='logicZone'),
          netArch?: string(name='netArch'),
          nic?: string(name='nic'),
          product3?: string(name='product3'),
          safeZone?: string(name='safeZone'),
          scenario?: string(name='scenario'),
          supplyAmount?: long(name='supplyAmount'),
          supplyDate?: string(name='supplyDate'),
          supplyType?: long(name='supplyType'),
        }
      ](name='dataList'),
      denamdCount?: long(name='denamdCount'),
      gapCnt?: long(name='gapCnt'),
      region?: string(name='region'),
      resourceMethodId?: long(name='resourceMethodId'),
      roomCode?: string(name='roomCode'),
    }
  ](name='methodList'),
  requestId?: string(name='requestId'),
  requireCnt?: long(name='requireCnt'),
  subDemandId?: string(name='subDemandId'),
}

model PushResourcePlanResponseBody = {
  code?: long(name='code'),
  data?: boolean(name='data'),
  message?: string(name='message'),
  success?: boolean(name='success'),
  traceId?: string(name='traceId'),
}

model PushResourcePlanResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: PushResourcePlanResponseBody(name='body'),
}

async function pushResourcePlanWithOptions(request: PushResourcePlanRequest, headers: PushResourcePlanHeaders, runtime: Util.RuntimeOptions): PushResourcePlanResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.bufferCnt)) {
    body['bufferCnt'] = request.bufferCnt;
  }
  if (!Util.isUnset(request.demandCount)) {
    body['demandCount'] = request.demandCount;
  }
  if (!Util.isUnset(request.demandId)) {
    body['demandId'] = request.demandId;
  }
  if (!Util.isUnset(request.methodList)) {
    body['methodList'] = request.methodList;
  }
  if (!Util.isUnset(request.requestId)) {
    body['requestId'] = request.requestId;
  }
  if (!Util.isUnset(request.requireCnt)) {
    body['requireCnt'] = request.requireCnt;
  }
  if (!Util.isUnset(request.subDemandId)) {
    body['subDemandId'] = request.subDemandId;
  }

  var realHeaders : map[string]string = {};
  if (!Util.isUnset(headers.commonHeaders)) {
    realHeaders = headers.commonHeaders;
  }
  if (!Util.isUnset(headers.yunUserId)) {
    realHeaders['Yun-User-Id'] = Util.toJSONString(headers.yunUserId);
  }
  var req = new OpenApi.OpenApiRequest{ 
    headers = realHeaders,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'PushResourcePlan',
    version = '2021-12-17',
    protocol = 'HTTPS',
    pathname = `/api/supply/resourcePlan/push`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function pushResourcePlan(request: PushResourcePlanRequest): PushResourcePlanResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers = new PushResourcePlanHeaders{};
  return pushResourcePlanWithOptions(request, headers, runtime);
}

model QueryDeliveredSupplyItemsRequest {
  accountId?: string(name='accountId'),
  commodityTypeCode?: string(name='commodityTypeCode'),
}

model QueryDeliveredSupplyItemsResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: [ 
    {
      accountId?: string(name='accountId'),
      commodityTypeCode?: string(name='commodityTypeCode'),
      demandPlanId?: long(name='demandPlanId'),
      planTitle?: string(name='planTitle'),
      region?: string(name='region'),
      zone?: string(name='zone'),
      commodityCode?: string(name='commodityCode'),
      demandCount?: int32(name='demandCount'),
      deliveredAmount?: int32(name='deliveredAmount'),
      openCount?: int32(name='openCount'),
    }
  ](name='body'),
}

async function queryDeliveredSupplyItemsWithOptions(request: QueryDeliveredSupplyItemsRequest, headers: map[string]string, runtime: Util.RuntimeOptions): QueryDeliveredSupplyItemsResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.accountId)) {
    query['accountId'] = request.accountId;
  }
  if (!Util.isUnset(request.commodityTypeCode)) {
    query['commodityTypeCode'] = request.commodityTypeCode;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'QueryDeliveredSupplyItems',
    version = '2021-12-17',
    protocol = 'HTTPS',
    pathname = `/api/supply/queryDeliveredSupplyItems`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'array',
  };
  return callApi(params, req, runtime);
}

async function queryDeliveredSupplyItems(request: QueryDeliveredSupplyItemsRequest): QueryDeliveredSupplyItemsResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return queryDeliveredSupplyItemsWithOptions(request, headers, runtime);
}

model QueryPeriodBudgetBillRequest {
  objectIds?: string(name='objectIds'),
  objectType?: string(name='objectType'),
  period?: string(name='period'),
}

model QueryPeriodBudgetBillResponseBody = {
  periodBudgetBillDTOS?: [ 
    {
      bill?: double(name='bill'),
      budget?: double(name='budget'),
      lastYearBill?: double(name='lastYearBill'),
      month?: string(name='month'),
    }
  ](name='periodBudgetBillDTOS'),
}

model QueryPeriodBudgetBillResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: QueryPeriodBudgetBillResponseBody(name='body'),
}

async function queryPeriodBudgetBillWithOptions(request: QueryPeriodBudgetBillRequest, headers: map[string]string, runtime: Util.RuntimeOptions): QueryPeriodBudgetBillResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.objectIds)) {
    query['objectIds'] = request.objectIds;
  }
  if (!Util.isUnset(request.objectType)) {
    query['objectType'] = request.objectType;
  }
  if (!Util.isUnset(request.period)) {
    query['period'] = request.period;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'QueryPeriodBudgetBill',
    version = '2021-12-17',
    protocol = 'HTTPS',
    pathname = `/api/annual/budget/queryPeriodBudgetBill`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function queryPeriodBudgetBill(request: QueryPeriodBudgetBillRequest): QueryPeriodBudgetBillResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return queryPeriodBudgetBillWithOptions(request, headers, runtime);
}

model SaveUrgentDemandItemHeaders {
  commonHeaders?: map[string]string,
  yunUserId?: string(name='Yun-User-Id', example='111222'),
}

model SaveUrgentDemandItemRequest {
  accountId?: string(name='accountId', example='12321312'),
  creator?: string(name='creator', example='111222'),
  effectTime?: string(name='effectTime', example='2021-12-27 00:00:00'),
  modifier?: string(name='modifier', example='111222'),
  networkType?: string(name='networkType', example='网络类型 vpc（私有网络）/classic（经典网络）'),
  payDuration?: string(name='payDuration', example='10'),
  payDurationUnit?: string(name='payDurationUnit', example='购买时长单位(month(月)，week(周)，day(天))'),
  payType?: string(name='payType', example='付费类型 prepay(预付费)/postpay（后付费）'),
  planId?: long(name='planId', example='111222'),
  region?: string(name='region', example='cn-beijing'),
  urgentDemandEbsRequest?: {
    commodityCode?: string(name='commodityCode', example='cloud_essd'),
    commodityNum?: long(name='commodityNum', example='1'),
    commodityTypeCode?: string(name='commodityTypeCode', example='yundisk'),
    itemId?: long(name='itemId', example='111222'),
    performanceLevel?: long(name='performanceLevel', example='1'),
  }(name='urgentDemandEbsRequest'),
  urgentDemandEcsRequest?: {
    commodityCode?: string(name='commodityCode', example='ecs.sn2ne.6xlarge'),
    commodityNum?: long(name='commodityNum', example='2'),
    commodityTypeCode?: string(name='commodityTypeCode', example='ecs'),
    itemId?: long(name='itemId', example='111222'),
    vCpuCount?: long(name='vCpuCount', example='2'),
  }(name='urgentDemandEcsRequest'),
  zone?: string(name='zone', example='cn-beijing-a'),
}

model SaveUrgentDemandItemResponseBody = {
  code?: long(name='code', example='0'),
  data?: [ long ](name='data'),
  message?: string(name='message', example='msg'),
  success?: boolean(name='success', example='true'),
  traceId?: string(name='traceId', example='2107d95616405752026995105e83b0'),
}

model SaveUrgentDemandItemResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: SaveUrgentDemandItemResponseBody(name='body'),
}

async function saveUrgentDemandItemWithOptions(request: SaveUrgentDemandItemRequest, headers: SaveUrgentDemandItemHeaders, runtime: Util.RuntimeOptions): SaveUrgentDemandItemResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.accountId)) {
    body['accountId'] = request.accountId;
  }
  if (!Util.isUnset(request.creator)) {
    body['creator'] = request.creator;
  }
  if (!Util.isUnset(request.effectTime)) {
    body['effectTime'] = request.effectTime;
  }
  if (!Util.isUnset(request.modifier)) {
    body['modifier'] = request.modifier;
  }
  if (!Util.isUnset(request.networkType)) {
    body['networkType'] = request.networkType;
  }
  if (!Util.isUnset(request.payDuration)) {
    body['payDuration'] = request.payDuration;
  }
  if (!Util.isUnset(request.payDurationUnit)) {
    body['payDurationUnit'] = request.payDurationUnit;
  }
  if (!Util.isUnset(request.payType)) {
    body['payType'] = request.payType;
  }
  if (!Util.isUnset(request.planId)) {
    body['planId'] = request.planId;
  }
  if (!Util.isUnset(request.region)) {
    body['region'] = request.region;
  }
  if (!Util.isUnset(request.urgentDemandEbsRequest)) {
    body['urgentDemandEbsRequest'] = request.urgentDemandEbsRequest;
  }
  if (!Util.isUnset(request.urgentDemandEcsRequest)) {
    body['urgentDemandEcsRequest'] = request.urgentDemandEcsRequest;
  }
  if (!Util.isUnset(request.zone)) {
    body['zone'] = request.zone;
  }

  var realHeaders : map[string]string = {};
  if (!Util.isUnset(headers.commonHeaders)) {
    realHeaders = headers.commonHeaders;
  }
  if (!Util.isUnset(headers.yunUserId)) {
    realHeaders['Yun-User-Id'] = Util.toJSONString(headers.yunUserId);
  }
  var req = new OpenApi.OpenApiRequest{ 
    headers = realHeaders,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'SaveUrgentDemandItem',
    version = '2021-12-17',
    protocol = 'HTTPS',
    pathname = `/api/demand/urgent/saveUrgentDemandItem`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function saveUrgentDemandItem(request: SaveUrgentDemandItemRequest): SaveUrgentDemandItemResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers = new SaveUrgentDemandItemHeaders{};
  return saveUrgentDemandItemWithOptions(request, headers, runtime);
}

model SubmitUrgentDemandPlanHeaders {
  commonHeaders?: map[string]string,
  yunUserId?: string(name='Yun-User-Id', example='262940'),
}

model SubmitUrgentDemandPlanRequest {
  planId?: string(name='planId', example='111223'),
  userId?: string(name='userId', example='262940'),
}

model SubmitUrgentDemandPlanResponseBody = {
  code?: long(name='code', description='code', example='0'),
  data?: boolean(name='data', example='true'),
  message?: string(name='message', example='msg'),
  success?: boolean(name='success', description='success', example='true'),
  traceId?: string(name='traceId', description='traceId', example='1e2b798516402440016572132e1459'),
}

model SubmitUrgentDemandPlanResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: SubmitUrgentDemandPlanResponseBody(name='body'),
}

async function submitUrgentDemandPlanWithOptions(request: SubmitUrgentDemandPlanRequest, headers: SubmitUrgentDemandPlanHeaders, runtime: Util.RuntimeOptions): SubmitUrgentDemandPlanResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.planId)) {
    query['planId'] = request.planId;
  }
  if (!Util.isUnset(request.userId)) {
    query['userId'] = request.userId;
  }

  var realHeaders : map[string]string = {};
  if (!Util.isUnset(headers.commonHeaders)) {
    realHeaders = headers.commonHeaders;
  }
  if (!Util.isUnset(headers.yunUserId)) {
    realHeaders['Yun-User-Id'] = Util.toJSONString(headers.yunUserId);
  }
  var req = new OpenApi.OpenApiRequest{ 
    headers = realHeaders,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'SubmitUrgentDemandPlan',
    version = '2021-12-17',
    protocol = 'HTTPS',
    pathname = `/api/demand/urgent/submitUrgentDemandPlan`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function submitUrgentDemandPlan(request: SubmitUrgentDemandPlanRequest): SubmitUrgentDemandPlanResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers = new SubmitUrgentDemandPlanHeaders{};
  return submitUrgentDemandPlanWithOptions(request, headers, runtime);
}

